import request from './request'

const http = {
    get(url, params, exConfig, exData) {
        const config = {
            method: 'get',
            url: url
        }
        if (params) config.params = params
        if (exConfig) config.exConfig = exConfig
        if (exData) config.exData = exData
        return request(config)
    },
    post(url, params, exConfig, exData) {
        const config = {
            method: 'post',
            url: url
        }
        if (params) config.data = params
        if (exConfig) config.exConfig = exConfig
        if (exData) config.exData = exData
        return request(config)
    },
    put(url, params, exConfig, exData) {
        const config = {
            method: 'post',
            url: url
        }
        if (params) config.data = params
        if (exConfig) config.exConfig = exConfig
        if (exData) config.exData = exData
        return request(config)
    },
    delete(url, params, exConfig, exData) {
        const config = {
            method: 'post',
            url: url
        }
        if (params) config.params = params
        if (exConfig) config.exConfig = exConfig
        if (exData) config.exData = exData
        return request(config)
    }
}

export default http